<%--
  Created by IntelliJ IDEA.
  User: 86183
  Date: 2019/8/21
  Time: 16:08
  To change this template use File | Settings | File Templates.
  //加条件显示userinfoshow页面
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%String path = request.getContextPath(); %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<table class="result-tab" width="100%">
    <tr>
        <th class="tc" width="5%"><input class="allChoose" name="" type="checkbox"></th>
        <th>ID</th>
        <th>姓名</th>
        <th>邮箱</th>
        <th>手机号</th>
        <th>注册时间</th>
        <th>最近登录时间</th>
        <th>操作</th>
    </tr >

    <c:forEach items="${requestScope.pageInfo.list}" var="userinfo" varStatus="stat">
        <tr>
            <td class="tc"><input name="id[]" value="59" type="checkbox"></td>

            <td>${userinfo.id}</td>
            <td class="name" data-id="${userinfo.id}">${userinfo.name}</td>
            <td>${userinfo.email}</td>
            <td>${userinfo.phone}</td>
            <td><fmt:formatDate value="${userinfo.registerTime}" pattern="yyyy-MM-dd"/></td>
            <td><fmt:formatDate value="${userinfo.lastLoginTime}" pattern="yyyy-MM-dd"/></td>
            <td>
               <span id="button">

                    <a data-id="${userinfo.id}" class="feng" style="color:red;"  href="#">封停</a>

            </span>


                &nbsp;

            </td>
        </tr>

    </c:forEach>

</table>
<tr>
    <div class="biankuang">

        <td colspan="7">
            <c:forEach  items="${requestScope.pageInfo.navigatepageNums}" var="i">
                <c:if test="${requestScope.pageInfo.pageNum eq i}" var="result">
                    <a href="#" id="ids" class="num pageNum" id="${i}">${i}</a>
                </c:if>
                <c:if test="${not result}" >
                    <a href="#" id="ids" class="num" id="${i}">${i}</a>
                </c:if>
            </c:forEach>
        </td>
    </div>
</tr>


<script type="text/javascript">
    var pageNum;


    $(".feng").click(function () {
        $.ajaxSettings.async = false;
        if (window.confirm("你确定要封停吗?")) {
            var pageNum = $("#ids").html();
            var id = $(this).data("id");
            var action = "${pageContext.request.contextPath}/manage/show/closure"
            var enable=0;



            $.post(action,{id:id,enable:enable},function (){


            })
            findAll();
        }
    })

    $.ajaxSettings.async = false;
    $(".jie").on("click",function () { //解封
        if (window.confirm("你确定要解封吗?")) {
            var pageNum = $(this).html();
            var id = $(this).data("id");
            var enable=1;
            var action = "${pageContext.request.contextPath}/manage/show/deblocking"

            $.post(action,{id:id,enable:enable},function () {

            })
            findAll();
        }
    })


    $(".num").click(function () { //给页码加点击事件
        pageNum = $(this).html();
        findAll(pageNum);

        return false;
    });

    function findAll() {

        var action ="${pageContext.request.contextPath}/manage/ajaxJsp/usershow1";
        var name ="${requestScope.name}";
        var province ="${requestScope.province}";
        var city ="${requestScope.city}";
        var area ="${requestScope.area}";
        if(province==null) province="";
        if(city==null) city="";
        if(area==null) area="";

        $.post(action,{name:name,pageNum:pageNum,province:province,city:city,area:area},function (mes) {
            $("#show").html(mes);
        })
        
    }
    
</script>